<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html >
 <%@include file="./resource/head.jsp" %> 
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>选择游戏</title>
    <!-- Tell the browser to be responsive to screen width -->
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">

  </head>
  <body ng-app="app" class=" werewolf" ng-controller="game">
  	<nav class="navbar navbar-default">
	    <div class="navbar-header">
	      <a class="navbar-brand" href="#">
	        <img alt="狼人杀" src="">
	      </a>
	    </div>
	</nav>
	<div class="container">
	  	<div class="row">
	  		<div class="col-xs-12">
		  		<table class="table">
		  			<tr ng-repeat="game in gamelist">
		  				<td>{{game.name}}</td>
		  				<td>
		  					<a class="btn btn-primary" ng-href="/werewolf/player/join?gamename={{game.name}}">进入游戏</a>
		  				</td>
		  			</tr>
		  		</table>
	  		</div>
	  	</div>
  	</div>
  </body>
  <%@include file="./resource/foot.jsp" %>  
  <script>
  var module=angular.module("app",[]);
  var gameList=module.controller("game",function($scope,$http){
	  $http({
		  url:"/werewolf/player/gamelist"
	  }).success(function(data){
		  $scope.gamelist=data.gamelist;
	  })
  });
  
  </script>
</html>
